package ru.jkff.jalgebra.order;

/**
 * User: jkff
 * Date: Aug 22, 2009
 * Time: 1:04:18 PM
 */
public abstract class BoundedLattice<T> extends Lattice<T> {
    public abstract T min();
    public abstract T max();

    public BoundedLattice<T> flip() {
        final BoundedLattice<T> us = this;
        return new BoundedLattice<T>() {
            public T min()                         { return us.max();              }
            public T max()                         { return us.min();              }
            public T sup(T a, T b)                 { return us.inf(a,b);           }
            public T inf(T a, T b)                 { return us.sup(a,b);           }
            public boolean isLessOrEqual(T a, T b) { return us.isLessOrEqual(b,a); }
        };
    }
}
